﻿// Version:1
// Author:Sanket Naik
// Date:July-21-2010 
// Comments:
// 
// 
// 


using System;
using System.Runtime.Serialization;
using System.Data.Linq.Mapping;
using ManagedServices.Common.DataTransferObject;
using System.ComponentModel;


namespace ManagedServices.DataTransferObjects
{
    /// <summary>
    /// The table representing the Identity of users in msf
    /// </summary>
    [DataContract]
    [global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Msf_Tbl_Identity")]
    public partial class Identity : INotifyPropertyChanging, INotifyPropertyChanged, ICommonDto
    {

        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);

        private System.Guid _Msf_Col_IdentityID;

        private string _Msf_Col_IdentityName;

        private string _Msf_Col_PassPhrase;

        private string _Msf_Col_IdentityPath;

        private System.Guid _Msf_Col_CreatedBy;

        private System.Nullable<System.Guid> _Msf_Col_ModifiedBy;

        private System.DateTime _Msf_Col_CreatedOn;

        private System.Nullable<System.DateTime> _Msf_Col_ModifiedOn;

        #region Extensibility Method Definitions
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
        partial void OnIdentityIDChanging(System.Guid value);
        partial void OnIdentityIDChanged();
        partial void OnIdentityNameChanging(string value);
        partial void OnIdentityNameChanged();
        partial void OnPassPhraseChanging(string value);
        partial void OnPassPhraseChanged();
        partial void OnIdentityPathChanging(string value);
        partial void OnIdentityPathChanged();
        partial void OnCreatedByChanging(System.Guid value);
        partial void OnCreatedByChanged();
        partial void OnModifiedByChanging(System.Nullable<System.Guid> value);
        partial void OnModifiedByChanged();
        partial void OnCreatedOnChanging(System.DateTime value);
        partial void OnCreatedOnChanged();
        partial void OnModifiedOnChanging(System.Nullable<System.DateTime> value);
        partial void OnModifiedOnChanged();
        #endregion

        /// <summary>
        /// Ctor
        /// </summary>
        public Identity()
        {
            OnCreated();
        }

        /// <summary>
        /// The Unique ID for each Identity
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_IdentityID", Storage = "_Msf_Col_IdentityID", DbType = "UniqueIdentifier NOT NULL", IsPrimaryKey = true)]
        public System.Guid IdentityID
        {
            get
            {
                return this._Msf_Col_IdentityID;
            }
            set
            {
                if ((this._Msf_Col_IdentityID != value))
                {
                    this.OnIdentityIDChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_IdentityID = value;
                    this.SendPropertyChanged("IdentityID");
                    this.OnIdentityIDChanged();
                }
            }
        }

        /// <summary>
        /// The Identity Name
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_IdentityName", Storage = "_Msf_Col_IdentityName", DbType = "NVarChar(250) NOT NULL", CanBeNull = false)]
        public string IdentityName
        {
            get
            {
                return this._Msf_Col_IdentityName;
            }
            set
            {
                if ((this._Msf_Col_IdentityName != value))
                {
                    this.OnIdentityNameChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_IdentityName = value;
                    this.SendPropertyChanged("IdentityName");
                    this.OnIdentityNameChanged();
                }
            }
        }

        /// <summary>
        /// The Identity PassPhrase
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_PassPhrase", Storage = "_Msf_Col_PassPhrase", DbType = "NVarChar(250)")]
        public string PassPhrase
        {
            get
            {
                return this._Msf_Col_PassPhrase;
            }
            set
            {
                if ((this._Msf_Col_PassPhrase != value))
                {
                    this.OnPassPhraseChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_PassPhrase = value;
                    this.SendPropertyChanged("PassPhrase");
                    this.OnPassPhraseChanged();
                }
            }
        }

        /// <summary>
        /// The Identity Path
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_IdentityPath", Storage = "_Msf_Col_IdentityPath", DbType = "NVarChar(100)")]
        public string IdentityPath
        {
            get
            {
                return this._Msf_Col_IdentityPath;
            }
            set
            {
                if ((this._Msf_Col_IdentityPath != value))
                {
                    this.OnIdentityPathChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_IdentityPath = value;
                    this.SendPropertyChanged("IdentityPath");
                    this.OnIdentityPathChanged();
                }
            }
        }

        /// <summary>
        /// Primary key for the DTO
        /// </summary>
        public Guid KeyId { get { return IdentityID; } set { IdentityID = value; } }

        /// <summary>
        /// Created By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedBy", Storage = "_Msf_Col_CreatedBy", DbType = "UniqueIdentifier NOT NULL")]
        public System.Guid CreatedBy
        {
            get
            {
                return this._Msf_Col_CreatedBy;
            }
            set
            {
                if ((this._Msf_Col_CreatedBy != value))
                {
                    this.OnCreatedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedBy = value;
                    this.SendPropertyChanged("CreatedBy");
                    this.OnCreatedByChanged();
                }
            }
        }

        /// <summary>
        /// Modified By
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedBy", Storage = "_Msf_Col_ModifiedBy", DbType = "UniqueIdentifier")]
        public System.Nullable<System.Guid> ModifiedBy
        {
            get
            {
                return this._Msf_Col_ModifiedBy;
            }
            set
            {
                if ((this._Msf_Col_ModifiedBy != value))
                {
                    this.OnModifiedByChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedBy = value;
                    this.SendPropertyChanged("ModifiedBy");
                    this.OnModifiedByChanged();
                }
            }
        }

        /// <summary>
        /// Created On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_CreatedOn", Storage = "_Msf_Col_CreatedOn", DbType = "DateTime NOT NULL")]
        public System.DateTime CreatedOn
        {
            get
            {
                return this._Msf_Col_CreatedOn;
            }
            set
            {
                if ((this._Msf_Col_CreatedOn != value))
                {
                    this.OnCreatedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_CreatedOn = value;
                    this.SendPropertyChanged("CreatedOn");
                    this.OnCreatedOnChanged();
                }
            }
        }

        /// <summary>
        /// Modified On
        /// </summary>
        [DataMember]
        [global::System.Data.Linq.Mapping.ColumnAttribute(Name = "Msf_Col_ModifiedOn", Storage = "_Msf_Col_ModifiedOn", DbType = "DateTime")]
        public System.Nullable<System.DateTime> ModifiedOn
        {
            get
            {
                return this._Msf_Col_ModifiedOn;
            }
            set
            {
                if ((this._Msf_Col_ModifiedOn != value))
                {
                    this.OnModifiedOnChanging(value);
                    this.SendPropertyChanging();
                    this._Msf_Col_ModifiedOn = value;
                    this.SendPropertyChanged("ModifiedOn");
                    this.OnModifiedOnChanged();
                }
            }
        }


        public event PropertyChangingEventHandler PropertyChanging;

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void SendPropertyChanging()
        {
            if ((this.PropertyChanging != null))
            {
                this.PropertyChanging(this, emptyChangingEventArgs);
            }
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            if ((this.PropertyChanged != null))
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
